#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:homework3_4.py
# author:wmf
# datetime:2021/4/5 22:32
# software: PyCharm
'''
this is function description
'''
# import module your need

# 4 题目要求：
# 在当前目录新建目录img, 里面包含10个文件, 10个文件名各不相同(X4G5.png)
# 将当前img目录所有以.png结尾的后缀名改为.jpg.

import os

# os.mkdir('img')
path = os.getcwd()
print(path)

for x in os.listdir(path + '\img'):
    tuple1 = os.path.splitext(x)
    str1 = '.jpg'
    if (tuple1[1] == '.png'):
        str1 = tuple1[0] + str1
        src = os.path.join(path, 'img', x)
        dst = os.path.join(path, 'img', str1)
        os.renames(src, dst)
